#include <iostream>
#include <Windows.h>

int main(int argc, char **argv)
{
	// CreateFile function
	// http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx
	HANDLE exchange_buffer = CreateFile(L"\\\\.\\KEXCB",
								GENERIC_READ | GENERIC_WRITE, 0, NULL,
								OPEN_EXISTING, 0, NULL);
	if (!exchange_buffer)
	{
		std::cerr << "Can't open kernel exchange buffer" << std::endl;
		return 1;
	}

	DWORD bytes_written = 0;
	const char buffer[] = "Test";
	const DWORD buffer_size = sizeof(buffer_size);
	WriteFile(exchange_buffer, buffer, buffer_size, &bytes_written, NULL);
	std::cout << bytes_written << " bytes written" << std::endl;

	CloseHandle(exchange_buffer);

	return 0;
}
